
<script type="text/javascript">
    $(document).ready(function(){
        $(".message-date").prettyDate();
        setInterval(function(){ $(".message-date").prettyDate(); }, 60000);
    })
</script>
<div id="contenting" class="">
    <table cellpadding="0" cellspacing="0" class="" width="100%" border="0">
    <?php foreach($messageList as $message): ?>
        <tr class="MessageListRow <?php echo $message['replystatustyperefid'] == Types::$MSG_STATUS['UNREAD'] && $message['replyto'] == $sf_user->getAttribute('currentuser')->getId() ? "unreadMessage" : "readMessage"?>"
            onclick="return loadMessage(<?php echo $message['id']; ?>);">
            <td class="checkbox tableData">
                <input type="checkbox" id="chkDelete" value="<?php echo $message['id']; ?>" onclick="deleteMessage(this, <?php echo $message['id']; ?>);"/>
            </td>
            <td class="icon tableData">
                <div class="mail_icon">
                    <a>
                        <?php if($message['entityid'] == $sf_user->getAttribute('currentuser')->getId()): ?>
                            <!-- if logged in user is message recipient, display the sender. -->
                            <img class="mailImage" src="<?php echo url_for('entityImage/index?entityid='.$message['msgfrom']) ?>" alt="<?php echo $message['from_firstname'] . ' ' .  $message['from_lastname']; ?>"/>
                        <?php else: ?>
                            <!-- if logged in user as message sender. -->
                            <img class="mailImage" src="<?php echo url_for('entityImage/index?entityid='.$message['entityid']) ?>" alt="<?php echo $message['firstname'] . ' ' .  $message['lastname'] ?>"/>
                        <?php endif; ?>
                    </a>
                </div>
            </td>
            <td class="envelope clickable tableData">
                <div class="authorLine">
                    <?php if($message['entityid'] == $sf_user->getAttribute('currentuser')->getId()): ?>
                        <a title="<?php echo $message['from_firstname'] . ' ' .  $message['from_lastname'] ?>" href="#"><?php echo $message['from_firstname'] . ' ' .  $message['from_lastname'] ?></a>
                    <?php else: ?>
                        <a title="<?php echo $message['firstname'] . ' ' .  $message['lastname'] ?>" href="#"><?php echo $message['firstname'] . ' ' .  $message['lastname'] ?></a>
                    <?php endif; ?>
                </div>
                <div>
                    <span class="message-date" title="<?php echo empty($message['replied_at']) ? $message['sent_at'] : $message['replied_at'] ?>"></span>
                </div>
            </td>
            <td class="clickable tableData">
                <a class="messageSubjectLine"><?php echo $message['subject'] ?></a>
                <div>
                    <?php echo strlen($message['shortbody']) == 100 ? preg_replace("/\<br \/\>/", " ", htmlspecialchars_decode($message['shortbody'])) . "..." : preg_replace("/\<br \/\>/", " ", htmlspecialchars_decode($message['shortbody'])) ?>
                </div>
            </td>
        </tr>
    <?php endforeach ?>
    </table>
    <input type="hidden" value=""/>
</div>






<div id="boxes">
 <div id="readmessage_" class="window" style="width:500px; height: 400px;">
     <div  class="windowheading"><a href="#"class="close"/><<img src="/images/close.png" width="18" height="18" alt="mails"/></div>
Load Data Against

    
     <table cellpadding="4" cellspacing="4" >
            <tr>
                <td rowspan="2" width="50px" valign="top">
                    <img src="/images/amjad.jpg" width="50px"/>
                </td>
                <td id="txtMessageSender" align="left"></td>
                <td id="txtMessageSubject" align="left">
                    <h3 id="txtMessageSubjectH3"></h3>
                </td>
            </tr>            
            <tr>
                <td></td>
                <td id="" align="left" colspan="2">
                    <div id="dvMessageBody" style="overflow: auto; height: 150px; width: 100%"></div>
                </td>
            </tr>
            <tr>
                <td align="left" colspan="3">
                    <div id="dvMessageReply" name="dvMessageReply">
                    </div>
                </td>
            </tr>
            
            <form id="frmSendMessageReply" name="frmSendMessageReply" action="<?php echo url_for('home/sendMessageReply') ?>">
                <tr>
                    <td>
                        <input type="hidden" id="hfMsgID" name="hfMsgID" value="" onchange="messageIDChanged();" />
                    </td>
                    <td>                        
                    </td>
                    <td id="" align="left" >
                        <br><br><h3>Reply</h3><textarea cols="20" id="txtMsgReply" name="Reply" rows="5" style="width: 100%"></textarea>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td></td>
                    <td id="" align="right" >
                        <br><a href="javascript: void(0);" class="btn" onclick="document.frmSendMessageReply.submit();return true;"> Reply </a>
                    </td>
                </tr>
        </form>
     </table>
    
 </div>
</div>